<template>
  <!--一键下单组件 id="zhibo_xiadan"  isConfigurationIcon-->
  <div class="shopping-box">
    <div id="zhibo_xiadan" class="shopping-btn-box" @click="clickShoppingList" :class="[zxyhClass]"
      v-if="isConfigurationIcon">
      <img :src="shoppingSrcUrl+ '?x-oss-process=image/resize,m_fixed,h_125,w_125'" />
    </div>
    <div id="zhibo_yijianxiadan" @click="clickShoppingList" class="shopping-btn-box" :class="[zxyhClass]" v-else>
      <div class="box">
        <div class="shop-text">
          {{shoppingTitle || '一键下单'}}
        </div>
      </div>
      <div class="shop-bar1"></div>
      <div class="shop-bar2"></div>
    </div>
  </div>
</template>

<script>
  export default {
    props: {
      shoppingTitle: {
        type: String,
        default: '一键下单'
      },
      shoppingIcon: String, //一键下单图标
      isPublic: Boolean, //直播间是否是公开不限制
      roomInfo: Object
    },
    data() {
      return {
        shoppingArray: [],
        roomId: this.$route.params.roomid,
        zxyhClass: '', //中信银行输入框遮挡问题
        shoppingSrcUrl: '',
        isConfigurationIcon: false, //配置图标
      }
    },
    created() {
      if (this.shoppingIcon) { //有值
        this.shoppingSrcUrl = this.shoppingIcon;
        this.isConfigurationIcon = true;
        //this.
      } else { //无值默认
        this.isConfigurationIcon = false
      }

    },
    watch: {
      '$store.state.zxyhChangeRightHeight': function(v) {
        if (this.$store.state.zxyhChangeRightHeight == 'zxyh') {
          this.zxyhClass = 'shopping-btn-box-zxyh';
        } else {
          this.zxyhClass = 'shopping-btn-box';
        }
      },
    },
    methods: {
      clickShoppingList() {
        if (this.$store.state.isYk) { //游客
          let jointUrl = fun.getCurPageUrl('live', this.$route.params.roomid)
          fun.ykDisposeFun(jointUrl);
          return;
        }
        this.$emit('formChildMsg', {
          type: 'clickShoppingBtn'
        })
      }
    },
  }
</script>

<style scoped="scoped">
  .shopping-box {
    width: 100vw;
    height: auto;
  }

  .shopping-list-box {
    position: absolute;
    left: 0;
    z-index: 1006;
  }

  .shopping-btn-box {
    position: absolute;
    right: 6px;
    bottom: 120px;
    z-index: 100;
    margin-top: 10px;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .shopping-btn-box img {
    width: 125px;
    height: 125px;
    /*border-radius: 50%;*/
    /*background-size: 125px 125px;*/
  }

  .shopping-btn-box .box {
    width: 125px;
    height: 125px;
    background: url("../../../../assets/images/yjxd.png") no-repeat;
    background-size: 125px 125px;
  }

  .shop-text {
    width: 96px;
    height: 30px;
    background: linear-gradient(11deg, #FE9E3D, #FF965D);
    font-size: 18px;
    border-radius: 5px;
    color: #fff;
    text-align: center;
    line-height: 30px;
    font-weight: 500;
    position: absolute;
    top: 55%;
    left: 50%;
    margin-left: -48px;
  }

  .shopping-btn-box-zxyh {
    position: absolute;
    right: 6px;
    bottom: 320px;
    z-index: 100;
  }

  .pic {
    width: 40px;
    position: absolute;
    right: 170px;
    top: 10px;
    animation: heartbeat 1s infinite;
    -webkit-animation: heartbeat 0.8s infinite;
  }

  @keyframes heartbeat {
    0% {
      transform: scale(1, 1);
    }

    25% {
      transform: scale(1.2, 1.2);
    }

    100% {
      transform: scale(1, 1);
    }
  }

  .shopping-list-header {
    width: 750px;
    height: 140px;
    border-radius: 30px 30px 0 0;
    background: url(../../../../assets/images/shoppingBg.png) no-repeat;
    background-size: 100vw 140px;
    /*position: absolute;
		top: 0;
		left: 0;
		z-index: 1001;*/
  }

  .shopping-list-header div {
    width: 53px;
    height: 46px;
    float: right;
    margin: 20px 20px 0 0;
  }

  .shopping-list-ul {
    width: 100%;
    overflow-y: scroll;
    max-height: 576px;
    /*position: absolute;
		top: 60px;
		left: 0;
		z-index: 1000;*/
    background: white;
  }

  .shopping-list-ul li {
    width: 100%;
    height: 192px;
    /*background: #CCCCCC;*/
  }

  .shopping-list-li-left {
    width: 250px;
    height: 100%;
    /* background: skyblue;*/
    float: left;
    position: relative;
  }

  .sort {
    width: 50px;
    height: 30px;
    background: rgba(0, 0, 0, 0.4);
    border-top-left-radius: 15px;
    position: absolute;
    top: 20px;
    left: 50px;
    font-size: 22px;
    font-weight: 400;
    color: #FFF;
    text-align: center;
    line-height: 30px;
  }

  .shopping-list-li-left>img {
    width: 150px;
    height: 150px;
    margin: 20px 0 0 50px;
    border-radius: 15px;
  }

  .shopping-list-li-left-block {
    position: absolute;
    left: 50px;
    top: 130px;
    width: 150px;
    height: 40px;
    line-height: 40px;
    text-align: center;
    background: #FE4B52;
    opacity: 0.8;
    border-radius: 0px 0px 15px 15px;
    font-size: 26px;
    font-weight: 400;
    color: #FFFFFF;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .shopping-list-li-left-block img {
    width: 28px;
    height: 28px;
    margin-right: 10px;
  }

  .shopping-list-li-right {
    width: 490px;
    height: 100%;
    /*background: seashell;*/
    float: left;
    position: relative;
  }

  .shopping-p {
    width: 100%;
    height: 80px;
    /*background: #87CEEB;*/
    font-size: 30px;
    color: #3b3b3b;
    font-weight: 600;
    margin-top: 30px;
    line-height: 40px;
  }

  .shopping-price {
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
    padding-right: 46px;
    font-size: 24px;
    color: #e31d1a;
    margin-top: 25px;
  }

  .shopping-priceNum {
    display: inline-block;
    width: calc(100% - 90px);
    font-size: 30px;
    font-weight: bold;
    overflow: hidden;
		text-overflow: ellipsis;
		display: -webkit-box;
		-webkit-line-clamp: 3;
		-webkit-box-orient: vertical;
  }

  .shopping-tagA {
    width: 54px;
    height: 54px;
    display: inline-block;
    background: url(../../../../assets/images/arrow_right.png) no-repeat;
    background-size: 54px 54px;
  }

  .shop-bar1 {
    width: 30px;
    height: 30px;
    position: absolute;
    top: 20px;
    left: 0;
    background: url('../../../../assets/images/yq2.png') no-repeat;
    background-size: 100%;
    animation-name: baring;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    animation-delay: 0s;
    animation-play-state: running;
  }

  .shop-bar2 {
    width: 30px;
    height: 30px;
    position: absolute;
    top: -2px;
    left: 60px;
    background: url('../../../../assets/images/yq1.png') no-repeat;
    background-size: 100%;
    animation-name: baring;
    animation-duration: 1s;
    animation-iteration-count: infinite;
    animation-timing-function: ease-in-out;
    animation-delay: 500ms;
    animation-play-state: running;
  }

  @keyframes baring {
    0% {
      transform: translate(0px, 0px);
    }

    50% {
      transform: translate(0px, 10px);
    }

    100% {
      transform: translate(0px, 0px);
    }
  }
</style>
